import { defineContentScript } from 'wxt/sandbox';
import { whatsappHandler } from '../utils/whatsappHandler';


export default defineContentScript({
  matches: ['https://web.whatsapp.com/*'],
  main() {
    console.log('WhatsApp content script loaded and running');
    
    // 调用 WhatsApp 处理器函数，获取清理函数
    const cleanup = whatsappHandler();
    
    // 返回清理函数，在内容脚本卸载时调用
    return () => {
      console.log('WhatsApp content script unloading, cleaning up...');
      cleanup();
    };
  },
});
